let height = [1,8,6,2,5,4,8,3,7]

let maxArea = function(height){
    let max = 0
    let temp = 0
    for(let i = 0; i < height.length; i++){
        for(let j = i; j < height.length; j++){
            temp = (j - i) * Math.min(height[i], height[j])
            max = Math.max(max, temp)
        }
    }
    return max
}

console.log(maxArea(height))
